#!/usr/bin/env node
const gulp = require('gulp'),//gulp基础库
    concat = require('gulp-concat'),//合并文件
    cssmin = require('gulp-minify-css'),//压缩css
    htmlmin = require("gulp-htmlmin"),//压缩html
    jsmin = require('gulp-uglify'),//压缩js
    imagemin = require('gulp-imagemin'),
    clean = require("gulp-clean"),//清理目录
    spritesmith=require('gulp.spritesmith'),
    less = require("gulp-less");//清理目录
    
const {destoption,srcoption} = require('./src/gulp/gulpPath');

//构建目录清理
gulp.task("clean", function (done) {
    gulp.src(destoption.pbxwebPath, {
        read: false
    })
    .pipe(clean({force: true}));

    gulp.src(destoption.ldapwebPath, {
        read: false
    })
    .pipe(clean({force: true}));

    gulp.src(destoption.autopwebPath, {
        read: false
    })
    .pipe(clean({force: true}));
    
    gulp.src(destoption.syswebPath, {
        read: false
    })
    .pipe(clean({force: true}));

    gulp.src(destoption.linkuswebPath, {
        read: false
    })
    .pipe(clean({force: true}));
    
    gulp.src(destoption.zohowebPath, {
        read: false
    })
    .pipe(clean({force: true}));
    done();
});

gulp.task('syswebmin', function(done){
    //===============html==================
    gulp.src([srcoption.syswebPath+'/*.html', srcoption.syswebPath+'/**/*.html'])
        .pipe(htmlmin({
            collapseWhitespace: true
        }))
        .pipe(gulp.dest(destoption.syswebPath))

    //===============js==================
    gulp.src([srcoption.syswebPath+'/**/*.js', '!'+srcoption.syswebPath+'/language/locale.js', '!'+srcoption.syswebPath+'/ext-6.0/*.js', '!'+srcoption.syswebPath+'/js/ext-ux.js','!'+srcoption.syswebPath+'/login/*.js', '!'+srcoption.syswebPath+'/apps/**/*.js'])
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.syswebPath))
    gulp.src([srcoption.syswebPath+'/login/base64.js', srcoption.syswebPath+'/login/md5.js'])
        .pipe(concat('encrypt.js'))
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.syswebPath + "/login/"))
    gulp.src([srcoption.syswebPath+'/ext-6.0/MultiSelect.js', srcoption.syswebPath+'/ext-6.0/ItemSelector.js', srcoption.syswebPath+'/ext-6.0/WebSocket.js', srcoption.syswebPath+'/ext-6.0/charts.js', srcoption.syswebPath+'/ext-6.0/Toolbar.js', srcoption.syswebPath+'/ext-6.0/DateTimePicker.js', srcoption.syswebPath+'/ext-6.0/DateTimeField.js', srcoption.syswebPath+'/ext-6.0/CTemplate.js',srcoption.syswebPath+'/ext-6.0/Component.js', srcoption.syswebPath+'/js/ext-ux.js'])
        .pipe(concat('ext-custom.js'))
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.syswebPath + "/ext-6.0/"))

    //===============images==================
    gulp.src([srcoption.syswebPath+'/images/**/*'])
        .pipe(imagemin())
        .pipe(gulp.dest(destoption.syswebPath + '/images/'))
    //===============images==================
    gulp.src([srcoption.syswebPath+'/photos/*'])
        .pipe(imagemin())
        .pipe(gulp.dest(destoption.syswebPath + '/photos/'))
    gulp.src(srcoption.syswebPath+'/login/images/**/')
        .pipe(imagemin())
        .pipe(gulp.dest(destoption.syswebPath + '/login/images/'))
    gulp.src(srcoption.syswebPath+'/ext-6.0/resources/images/**')
        .pipe(imagemin())
        .pipe(gulp.dest(destoption.syswebPath + '/ext-6.0/resources/images/'))


    /*//===============less==================
    gulp.src(srcoption.syswebPath+'/css/oem_12.less')
        .pipe(less())
        .pipe(gulp.dest(srcoption.syswebPath + '/css/'));*/

    //===============css==================
    gulp.src([srcoption.syswebPath+'/css/extjs.css', srcoption.syswebPath+'/css/ItemSelector.css',srcoption.syswebPath+'/css/MultiSelector.css'])
        .pipe(concat('ext-custom.css'))
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.syswebPath + "/css/"))
    gulp.src([srcoption.syswebPath+'/css/yeastar.css', srcoption.syswebPath+'/css/controlpanel.css'])
        .pipe(concat('desktop-custom.css'))
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.syswebPath + "/css/"))

    gulp.src(srcoption.syswebPath+'/login/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.syswebPath + '/login'))
    gulp.src(srcoption.syswebPath+'/ext-6.0/resources/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.syswebPath + '/ext-6.0/resources'))
    /*gulp.src([srcoption.syswebPath+'/css/oem*.css', srcoption.syswebPath+'/css/oem_*.css'])
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.syswebPath + '/css'))*/

    //===============copy==================
    gulp.src(srcoption.syswebPath+'/language/locale.js')
    .pipe(gulp.dest(destoption.syswebPath + '/language/'))
    gulp.src(srcoption.syswebPath+'/ext-6.0/ext-all.js')
    .pipe(gulp.dest(destoption.syswebPath + '/ext-6.0/'))
    gulp.src([srcoption.syswebPath+'/ext-6.0/resources/**', '!'+srcoption.syswebPath+'/ext-6.0/resources/*.css', '!'+srcoption.syswebPath+'/ext-6.0/resources/images'])
    .pipe(gulp.dest(destoption.syswebPath + '/ext-6.0/resources/'))
    gulp.src(srcoption.syswebPath+'/player/*')
    .pipe(gulp.dest(destoption.syswebPath + '/player/'))
    gulp.src(srcoption.syswebPath+'/data/*')
    .pipe(gulp.dest(destoption.syswebPath + '/data/'))
    gulp.src(srcoption.syswebPath+'/apps/.keep')
    .pipe(gulp.dest(destoption.syswebPath + '/apps/'))

    done()
});

gulp.task('pbxwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.pbxwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.pbxwebPath))
    //===============images==================
    gulp.src(srcoption.pbxwebPath+'/images/*.png')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.pbxwebPath + '/images'))
    //===============css==================
    gulp.src(srcoption.pbxwebPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.pbxwebPath + '/css/'))
    //===============copy==================
    gulp.src(srcoption.pbxwebPath+'/css/fonts/*')
    .pipe(gulp.dest(destoption.pbxwebPath + '/css/fonts/'))

    done()
});

gulp.task('ldapwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.ldapwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.ldapwebPath))
    //===============images==================
    //===============css==================
    gulp.src(srcoption.ldapwebPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.ldapwebPath + '/css/'))
    //===============copy==================

    done()
});

gulp.task('autopwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.autopwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.autopwebPath))
    //===============images==================
    gulp.src(srcoption.autopwebPath+'/images/*.png')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.autopwebPath + '/images'))
    //===============css==================
    gulp.src(srcoption.autopwebPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.autopwebPath + '/css/'))
    //===============copy==================
    gulp.src(srcoption.autopwebPath+'/data/*')
    .pipe(gulp.dest(destoption.autopwebPath + '/data/'))

    done()
});

gulp.task('conferencewebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.conferencewebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.conferencewebPath))
    //===============images==================
    gulp.src(srcoption.conferencewebPath+'/images/*.png')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.conferencewebPath + '/images'))
    //===============css==================
    gulp.src(srcoption.conferencewebPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.conferencewebPath + '/css/'))
    //===============copy==================

    done()
});

gulp.task('linkuswebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.linkuswebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.linkuswebPath))
    //===============images==================
    gulp.src(srcoption.linkuswebPath+'/images/**/*.png')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.linkuswebPath + '/images'))

    gulp.src(srcoption.linkuswebPath+'/images/**/*.gif')
    .pipe(gulp.dest(destoption.linkuswebPath + '/images'))
    //===============css==================
    gulp.src(srcoption.linkuswebPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.linkuswebPath + '/css/'))

    done()
});

gulp.task('vpnsrvwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.vpnserverwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.vpnserverwebPath))
    //===============images==================
    gulp.src(srcoption.vpnserverwebPath+'/images/*.png')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.vpnserverwebPath + '/images'))
    //===============css==================
    gulp.src(srcoption.vpnserverwebPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.vpnserverwebPath + '/css/'))
    
    done()    
});

gulp.task('mikoctiwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.mikoctiwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.mikoctiwebPath))
    //===============images==================
    gulp.src(srcoption.mikoctiwebPath+'/images/*.png')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.mikoctiwebPath + '/images'))
    //===============css==================
    gulp.src(srcoption.mikoctiwebPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.mikoctiwebPath + '/css/'))
    
    done()    
});

gulp.task('billingwebmin', function(done){
    //===============html==================
    gulp.src(srcoption.billingwebPath+'/css/font/*.html')
        .pipe(htmlmin({
            collapseWhitespace: true
        }))
        .pipe(gulp.dest(destoption.billingwebPath + '/css/font/'))
    //===============js==================
    gulp.src(srcoption.billingwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.billingwebPath))
    //===============images==================
    gulp.src(srcoption.billingwebPath+'/images/*.png')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.billingwebPath + '/images'))
    //===============css==================
    gulp.src(srcoption.billingwebPath+'/css/**/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.billingwebPath + '/css/'))

    //===============copy==================
    gulp.src([srcoption.billingwebPath+'/css/font/*.eot', srcoption.billingwebPath+'/css/font/*.svg', srcoption.billingwebPath+'/css/font/*.ttf', srcoption.billingwebPath+'/css/font/*.woff'])
    .pipe(gulp.dest(destoption.billingwebPath + '/css/font/'))


    done()
});

gulp.task('charwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.charhotelwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.charhotelwebPath))
    //===============images==================
    gulp.src(srcoption.charhotelwebPath+'/images/*.png')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.charhotelwebPath + '/images'))
    //===============css==================
    gulp.src(srcoption.charhotelwebPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.charhotelwebPath + '/css/'))


    done()
});

gulp.task('hotelwebmin', function(done){
    //===============html==================
    gulp.src([srcoption.hotelwebPath+'/**/*.html'])
        .pipe(htmlmin({
            collapseWhitespace: true
        }))
        .pipe(gulp.dest(destoption.hotelwebPath))
    //===============js==================
    gulp.src(srcoption.hotelwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.hotelwebPath))
    //===============images==================
    gulp.src(srcoption.hotelwebPath+'/images/*.png')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.hotelwebPath + '/images'))
    //===============css==================
    gulp.src(srcoption.hotelwebPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.hotelwebPath + '/css/'))


    done()
});

gulp.task('smartvsipwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.smartvsipwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.smartvsipwebPath))
    //===============images==================
    gulp.src(srcoption.smartvsipwebPath+'/images/*.png')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.smartvsipwebPath + '/images'))
    //===============css==================
    gulp.src(srcoption.smartvsipwebPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.smartvsipwebPath + '/css/'))


    done()    
});

gulp.task('qmwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.qmwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.qmwebPath))
    //===============images==================
    gulp.src(srcoption.qmwebPath+'/images/*.png')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.qmwebPath + '/images'))
    //===============css==================
    gulp.src(srcoption.qmwebPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.qmwebPath + '/css/'))

    done()
});

gulp.task('zohowebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.zohowebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.zohowebPath))
    //===============images==================
    gulp.src(srcoption.zohowebPath+'/images/*.png')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.zohowebPath + '/images'))
    //===============css==================
    gulp.src(srcoption.zohowebPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.zohowebPath + '/css/'))
    //===============copy==================

    done()
});
gulp.task('swebdemomin', function(done){
    //===============html==================
    gulp.src([srcoption.swebdemoPath+'/*.html', srcoption.swebdemoPath+'/**/*.html'])
        .pipe(htmlmin({
            collapseWhitespace: true
        }))
        .pipe(gulp.dest(destoption.swebdemoPath))

    gulp.src(srcoption.swebdemoPath+'/apps/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.swebdemoPath+'/apps/'))
    
    gulp.src(srcoption.swebdemoPath+'/js/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.swebdemoPath+'/js/'))

    gulp.src(srcoption.swebdemoPath+'/language/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.swebdemoPath+'/language/'))

    gulp.src(srcoption.swebdemoPath+'/login/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.swebdemoPath+'/login/'))

    gulp.src(srcoption.swebdemoPath+'/modules/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.swebdemoPath+'/modules/'))

    gulp.src(srcoption.swebdemoPath+'/ext-6.0/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.swebdemoPath+'/ext-6.0/'))

    //===============images==================
    gulp.src(srcoption.swebdemoPath+'/images/**/*')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.swebdemoPath + '/images/'))
    
    gulp.src(srcoption.swebdemoPath+'/apps/**/images/*')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.swebdemoPath + '/apps/'))

    gulp.src(srcoption.swebdemoPath+'/login/images/*')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.swebdemoPath + '/login/images/'))

    //===============css==================
    gulp.src(srcoption.swebdemoPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.swebdemoPath + '/css/'))

    gulp.src(srcoption.swebdemoPath+'/apps/**/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.swebdemoPath + '/apps/'))

    gulp.src(srcoption.swebdemoPath+'/login/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.swebdemoPath + '/login/'))

    //===============copy==================
    gulp.src(srcoption.swebdemoPath+'/player/*')
    .pipe(gulp.dest(destoption.swebdemoPath + '/player/'))
    gulp.src(srcoption.swebdemoPath+'/photos/*')
    .pipe(gulp.dest(destoption.swebdemoPath + '/photos/'))
    gulp.src(srcoption.swebdemoPath+'/ext-6.0/resources/**/*')
    .pipe(gulp.dest(destoption.swebdemoPath + '/ext-6.0/resources/'))
    gulp.src(srcoption.swebdemoPath+'/data/*')
    .pipe(gulp.dest(destoption.swebdemoPath + '/data/'))
    gulp.src(srcoption.swebdemoPath+'/apps/**/data/**/*')
    .pipe(gulp.dest(destoption.swebdemoPath + '/apps/'))


    done()
});


//=============================PC Pack Begin====================================================
gulp.task('pbxpcwebmin', function(done){
    //==============pc===================
    gulp.src(srcoption.pbxwebpcPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.pbxwebPath))


    done()
});

gulp.task('syspcwebmin', function(done){
    //===============html==================
    gulp.src(srcoption.syswebpcPath+'/**/*.html')
        .pipe(htmlmin({
            collapseWhitespace: true
        }))
        .pipe(gulp.dest(destoption.syswebPath))
    //===============js==================
    gulp.src(srcoption.syswebpcPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.syswebPath))
    gulp.src([srcoption.syswebPath+'/ext-6.0/MultiSelect.js', srcoption.syswebPath+'/ext-6.0/ItemSelector.js', srcoption.syswebPath+'/ext-6.0/WebSocket.js', srcoption.syswebPath+'/ext-6.0/charts.js', srcoption.syswebPath+'/ext-6.0/Toolbar.js', srcoption.syswebPath+'/ext-6.0/DateTimePicker.js', srcoption.syswebPath+'/ext-6.0/DateTimeField.js', srcoption.syswebPath+'/ext-6.0/CTemplate.js',srcoption.syswebPath+'/ext-6.0/Component.js', srcoption.syswebpcPath+'/js/ext-ux.js'])
        .pipe(concat('ext-custom.js'))
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.syswebPath + "/ext-6.0/"))
    //===============css==================
    gulp.src([srcoption.syswebpcPath+'/css/extjs.css', srcoption.syswebpcPath+'/css/ItemSelector.css',srcoption.syswebpcPath+'/css/MultiSelector.css'])
        .pipe(concat('ext-custom.css'))
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.syswebPath + "/css/"))
    gulp.src([srcoption.syswebpcPath+'/css/yeastar.css', srcoption.syswebpcPath+'/css/controlpanel.css'])
        .pipe(concat('desktop-custom.css'))
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.syswebPath + "/css/"))

    gulp.src(srcoption.syswebpcPath+'/login/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.syswebPath + '/login'))
        
    //===============images==================
    gulp.src(srcoption.syswebpcPath+'/images/**/*')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.syswebPath + '/images/'))
    
    gulp.src(srcoption.syswebpcPath+'/apps/**/images/*')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.syswebPath + '/apps/'))

    gulp.src(srcoption.syswebpcPath+'/login/images/*')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.syswebPath + '/login/images/'))



    done()

});

gulp.task('linkuspcwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.linkuspcwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.linkuswebPath))

    done()
});

gulp.task('vpnsrvpcwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.vpnserverpcwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.vpnserverwebPath))

    done()
});

//pc
gulp.task('ldappcwebmin', function(done){
    //==============pc===================
    gulp.src(srcoption.ldapwebpcPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.ldapwebPath))

    done()
});

gulp.task('hotelpcwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.hotelpcwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.hotelwebPath))


    done()
});
//=============================PC Pack End====================================================



//=============================CloudPBX Pack Begin====================================================
gulp.task('pbxcloudwebmin', function(done){
    //==============cloud===================
    gulp.src(srcoption.pbxwebcloudPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.pbxwebPath))
    //===============images==================
    gulp.src(srcoption.pbxwebcloudPath+'/images/*.png')
    .pipe(imagemin())
    .pipe(gulp.dest(destoption.pbxwebPath + '/images'))
    //===============css==================
    gulp.src(srcoption.pbxwebcloudPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.pbxwebPath + '/css/'))
    //===============copy==================
    gulp.src(srcoption.pbxwebcloudPath+'/images/*.gif')
    .pipe(gulp.dest(destoption.pbxwebPath + '/images/'))


    done()
});

gulp.task('syscloudwebmin', function(done){
    //===============html==================
    gulp.src(srcoption.syswebcloudPath+'/**/*.html')
        .pipe(htmlmin({
            collapseWhitespace: true
        }))
        .pipe(gulp.dest(destoption.syswebPath))
    //===============js==================
    gulp.src(srcoption.syswebcloudPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.syswebPath))

    //===============images==================
    gulp.src([srcoption.syswebcloudPath+'/images/**/*'])
        .pipe(imagemin())
        .pipe(gulp.dest(destoption.syswebPath + '/images/'))
        
    //===============image==================
    gulp.src(srcoption.syswebcloudPath+'/login/images/**/')
        .pipe(imagemin())
        .pipe(gulp.dest(destoption.syswebPath + '/login/images/'))

    //===============css==================
    gulp.src([srcoption.syswebcloudPath+'/css/yeastar.css', srcoption.syswebcloudPath+'/css/controlpanel.css'])
        .pipe(concat('desktop-custom.css'))
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.syswebPath + "/css/"))
    gulp.src(srcoption.syswebcloudPath+'/login/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.syswebPath + '/login'))


    done()
});


gulp.task('linkuscloudwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.linkuscloudwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.linkuswebPath))


    done()
});

gulp.task('vpnsrvcloudwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.vpnservercloudwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.vpnserverwebPath))


    done()    
});

gulp.task('autopcloudwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.autopcloudwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.autopwebPath))

    done()
});

gulp.task('conferencecloudwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.conferencewebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.conferencewebPath))
    //===============copy==================

    done()
});

gulp.task('zohocloudwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.zohowebcloudPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.zohowebPath))


    done()
});

gulp.task('ldapcloudwebmin', function(done){
    //===============html==================
    //===============js==================
    gulp.src(srcoption.ldapcloudwebPath+'/**/*.js')
        .pipe(jsmin())
        .pipe(gulp.dest(destoption.ldapwebPath))
    //===============images==================
    //===============css==================
    gulp.src(srcoption.ldapcloudwebPath+'/css/*.css')
        .pipe(cssmin())
        .pipe(gulp.dest(destoption.ldapwebPath + '/css/'))
    //===============copy==================
    done()
});
//=============================CloudPBX Pack Begin====================================================


gulp.task('jshint', function (done) {  
    gulp.src(srcoption.pbxwebcloudPath+'/**/*.js')  
        .pipe(plugins.jshint())  
        .pipe(plugins.jshint.reporter()); // 输出检查结果  


    done()
}); 



// gulp.task('test', function (cb) {

//     //===============js==================
//     gulp.src([source + '/js/*.js'])
//         .pipe(jsmin())
//         .pipe(gulp.dest(dest + '/js/'));
//     gulp.src([source + '/css/*.css'])
//         .pipe(cssmin())
//         .pipe(gulp.dest(dest + "/css/"))
//         .on('finish', () => {
//             emmiter.emit('gulpfile.finish', { status: 1, data: {} });
//         }).on('error',()=>{
//             error('gulp 压缩错误')
//         });
//     cb()
// });